<template>
  <div class='page-container'>
    <div class="loading" v-show="isShow" :class="{'fulled': isFulled}">
      <div class="loader" @click="startLoading">
        <div class="box">
          <div class="full" :class="{'fulled': isFulled}" ></div>
        </div>
      </div>
      <div class="loader-over" :class="{'fulled': isFulled}"></div>
    </div>

    <p>hello world!!!</p>
    <p>hello world!!!</p>
    <p>hello world!!!</p>
    <p>hello world!!!</p>
    <p>hello world!!!</p>
  </div>
</template>
<script>
export default {
  name: 'LoadingDemo',
  components: {},
  computed: {},
  data() {
    return {
      isShow: true,
      isFulled: false
    }
  },
  created() {
  },
  mounted() {
  },
  beforeDestroy() {
  },
  methods: {
    startLoading() {
      if(!this.isFulled) {
        this.isFulled = true
        setTimeout(() => {
          this.isShow = false
        }, 12000)
      }
    }
  }
}
</script>

<style scoped lang="less">
@mainColor:rgb(255, 255, 255);
.page-container {
  min-height: 100vh;

  .loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    overflow: hidden;
    &.fulled {
      opacity: 0;
      transition: opacity 1s linear 11s;
    }
  }

  .loader-over {
    width: 0;
    height: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    border-radius: 50%;
    background-color: @mainColor;
    &.fulled {
      width: 200vh;
      height: 200vh;
      transition: all 1s linear 10s;
    }
  }


  .loader {
    position: relative;
    width: 400px;
    height: 400px;
    background-color: black;
    overflow: hidden;
    filter: blur(4px) contrast(20);

    .box {
      position: absolute;
      top: 50%;
      left: 50%;
      width: 90%;
      height: 90%;
      border: 20px solid @mainColor;
      overflow: hidden;
      transform: translate(-50%, -50%);
      box-sizing: border-box;
      border-radius: 100%;

      &:before {
        content: "Loading Loading Loading";
        position: absolute;
        top: 50%;
        left: 50%;
        color: @mainColor;
        font-size: 60px;
        letter-spacing: 1px;
        font-weight: bolder;
        white-space: nowrap;
        transform: translate(100%, -50%);
        animation: marquee 4.25s infinite linear;
        text-shadow: 0 50px 10px rgba(255, 255, 255, 0.6);
        z-index: 100;
      }

      @keyframes marquee {
        from {
          transform: translate(-34%, -50%);
        }
        to {
          transform: translate(-68%, -50%);
        }
      }

      &:after {
        content: "";
        position: absolute;
        bottom: -20px;
        left: 50%;
        margin-left: -20px;
        width: 40px;
        height: 30px;
        background: @mainColor;
        border-radius: 50%;
        transform-origin: 50% -160px;
        transform: rotateZ(90deg);
        animation: rotate 8s 0.2s infinite linear;
        z-index: 100;
      }

      @keyframes rotate {
        from {
          transform: rotateZ(0deg);
        }
        to {
          transform: rotateZ(360deg);
        }
      }

      .full {
        width: 100%;
        height: 0;
        position: absolute;
        bottom: 0;
        left: 0;
        background-color: @mainColor;

        @keyframes rotate2 {
          0% {
            transform: translate(-50%, -65%) rotate(0deg);
          } 100% {
              transform: translate(-50%, -65%) rotate(360deg);
            }
        }
        @keyframes rotate3 {
          0% {
            transform: translate(-50%, -60%) rotate(0deg);
          } 100% {
              transform: translate(-50%, -60%) rotate(360deg);
            }
        }

        &.fulled {
          height: 180%;
          transition: height 10s linear;

          &::before {
            content: "";
            position: absolute;
            width: 150%;
            height: 600px;
            top: 0;
            left: 50%;
            border-radius: 42%;
            background-color: rgba(0, 0, 0, .4);
            transform: translate(-50%, 65%) rotate(0);
            animation: rotate2 4s linear infinite;
            z-index: 20;
          }
          &::after {
            content: "";
            position: absolute;
            width: 150%;
            height: 600px;
            top: 0;
            left: 50%;
            border-radius: 42%;
            background-color: rgba(0, 0, 0, .9);
            transform: translate(-50%, 60%) rotate(0);
            animation: rotate3 3s linear infinite;
            z-index: 20;
          }
        }
      }
    }
  }
}
</style>
